/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2023 —11 —05
 * Time: 21:33
 */
public class DATE {


    //成员变量
    public int year;
    public int month;
    public int day;

    /*
    public void setday(DATE this , int y, int m, int d ){//一般程序员写代码是不加this的
        this.year = y;
        this.month = m;
        this.day = d;
    }
    */



    //形参变量和成员变量是一样的时候，加this，不管一不一样都加上，要不然不可能给对象赋值了
    public void setday(DATE this , int y, int m, int d ){//一般程序员写代码是不加this的
        this.year = year;
        this.month = month;
        this.day = day;
    }

    public void print(){
        System.out.println("year:" + year + " month：" + "day:" + day);
    }


    public static void main(String[] args) {
        DATE date = new DATE();
        date.setday(2023,11,05);
        date.year = 2023;
        date.month = 11;
        date.day = 05;


        System.out.println("==============");
        //问题，你怎么知道调用的方法赋值给谁了
        DATE date1 = new DATE();
        date1.setday(1199,21,21);//谁调用了这个方法，那么this就是谁



        DATE date2 = new DATE();
        date2.setday(2131,213,213);//
    }

}

